"""
URL configuration for Xinjiaowu_Crm project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from Xinjiaowu_Crm import settings
from django.contrib import admin
from django.urls import path, re_path
from django.views.static import serve


from Ajax_Api.views import ajax_get_kehu_data, get_fenlei_chanpin
from ChanPin.views import product_list, ChanpinCreateView, Chanpin_dd_DeleteView, my_cp_ddListView, Add_Kehu_Dd
############################# 客户 —— 引入 ################################
# from KeHu.gonghaiviews import gonghai_listview, Gonghai_KehuUpdateView
from KeHu.kehu_bjgl import bjgl_kehulist
from KeHu.views import Kehu_zt_update,my_hasdd_kehu,My_Nodd_Kehu
from KeHu.views import kehulist, KeHuCreateView, KehuDeleteView, KehuUpdateView, KehuDetail, KeHuZilaoCreateOrUpdate, \
    genjinlogsDeleteView

################################ 客户 —— 引入 #############################
from jiaowu_xueyuan.views import Xueyuan_list,Banji_List,Xueyuan_Detail,Banji_Detail
from jiaowu_xueyuan.banji_views import Xueyuan_Jinban_banji,Xueyuan_Jinban_banji_add
from jiaowu_xueyuan.views import Xueyuan_add

##################################### 主体视图 —— 引入 ################################
from qxcrm_index.login import login_view, logout_view
from qxcrm_index.views import home,New_List,New_Detail, upload_image
from qxcrm_index.utils import upload_excel_file
############################### 工具 —— 引入 ################################
from qxcrm_index.tool_beiwang import BeiWang,BeiWangDetail,BeiWangCreate,BeiWangDelete
from qxcrm_index.tool_user_zhanneixin import tool_user_zhanneixin,tool_user_zhanneixinDelete,tool_user_zhanneixinDetail,\
    tool_user_zhanneixinCreate
#################
#from xtuser.views import userlist, UserCreateView, UserDeleteView, UserUpdateView

###教务管理
from jiaowu_xueyuan.views import Banji_xueyuan_Add
from jiaowu_xueyuan.views import Xueyuan_Update,Xueyuan_ziliao_UpdateView




urlpatterns = [

    re_path(r'media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
    path('login/', login_view, name='login'),
    path('logout/', logout_view, name='logout'),
    path('', home, name='home'),




    # path("", userlist.as_view(), name="index"),
    path('admin/', admin.site.urls),
    # path('userlist/', userlist.as_view(), name="userlist"),
    # path('adduser/', UserCreateView.as_view(), name="User_Create"),
    # path('userlist/<int:pk>/delete/', UserDeleteView.as_view(), name='user_delete'),
    # path('userlist/<int:pk>/up/', UserUpdateView.as_view(), name='user_up'),


    ####################### 客户
    path('kehulist/', kehulist.as_view(), name="kehu_list"),  # 所有客户列表
    path('hasdd-kehu-list/', my_hasdd_kehu.as_view(), name="hasdd_kehu_list"),  # 有订单客户列表
    path('nodd-kehu-list/', My_Nodd_Kehu.as_view(), name="nodd_kehu_list"),  # 所有没成交客户列表
    path('addkehu/', KeHuCreateView.as_view(), name="Kehu_Create"),  # 添加客户
    path('kehu/<int:pk>/delete/', KehuDeleteView.as_view(), name='kehu_delete'),
    path('kehu/<int:pk>/detail/', KehuDetail.as_view(), name='Kehu_detail'),  # 客户详情
    path('kehu/<int:pk>/update/', KehuUpdateView.as_view(), name='kehu_update'),  # 客户更新
    path('kehu/<int:pk>/zilao/', KeHuZilaoCreateOrUpdate.as_view(), name='kehu_zilao_create_or_update'),  # 添加客户子表{客户资料}
    path('kehu/log/<int:pk>/del/', genjinlogsDeleteView.as_view(), name='genjinlogs_delete'),  # 删除客户子表{客户更进记录}
    path('kehu/<int:pk>/add_dd/', Add_Kehu_Dd.as_view(), name='kehu_add_dd'),#新增客户订单

    ######################产品
    path('productlist/', product_list.as_view(), name="product_list"),
    path('addproduct/', ChanpinCreateView.as_view(), name="Product_Create"),
    path('kehudd/<int:khid>/<int:pk>/delete/', Chanpin_dd_DeleteView.as_view(), name='kehudd_delete'),  # 删除客户订单
    path('myddlist/', my_cp_ddListView.as_view(), name="mydd_list"),
    path('<int:pk>/ztupdate/', Kehu_zt_update.as_view(), name="kehu_zt_update"),  # 客户状态更新



    ######################公海管理
    # path('kehu_gonghai/', gonghai_listview.as_view(), name="kehu_gonghai_list"),  # 公海客户列表
    # path('<int:pk>/gonghai_zt/', Gonghai_KehuUpdateView.as_view(), name="kehu_gonghai_zhuanhuan"),  # 进出公海

    #######################查询ajax_api
    path('api/get_dingdan_kehu/', ajax_get_kehu_data, name="api_get_kehu_data"),  ##根据key筛选不同的数据
    path('api/get_fenlei_chanpin/', get_fenlei_chanpin, name="api_get_fenlei_chanpin"),

    ####################### 教务管理
    path('xueyuan/', Xueyuan_list.as_view(), name="Xueyuan_list"),  # 全部学员列表    # 应管理员 或教务管理员可见
    path('xueyuan/add/', Xueyuan_add.as_view(), name="Xueyuan_add"),
    path('xueyuan/<int:pk>/detail/', Xueyuan_Detail.as_view(), name="Xueyuan_detail"),  # 学员详情
    path('xueyuan/<int:pk>/update/', Xueyuan_Update.as_view(), name='Xueyuan_Update'),  # 学员更新 ajax
    path('xueyuan/<int:pk>/ziliaoupdate/', Xueyuan_ziliao_UpdateView.as_view(), name='Xueyuan_ziliao_Update'),  # 学员资料更新
    path('xueyuan/<int:pk>/jinban/', Xueyuan_Jinban_banji.as_view(), name='Xueyuan_Jinban_banji'),  # 学员进班
    path('xueyuan/<int:xueyuan_id>/jinban/<int:jinban_id>/add/', Xueyuan_Jinban_banji_add.as_view(), name='xueyuan_jinban_banji_add'),

    ################班级管理
    path('bjgl_kehulist/', bjgl_kehulist.as_view(), name="bjgl_kehulist"),
    path('banji/', Banji_List.as_view(), name="Banji"),#班级列表
    path('banji/<int:pk>/detail/', Banji_Detail.as_view(), name="banji_detail"), # 班级详情
    path('banji/<int:pk>/xueyuan_add/', Banji_xueyuan_Add.as_view(), name="Banji_xueyuan_Add"),#学员进入班级



    #####资讯
    path('newlist/', New_List.as_view(), name="newlist"),
    path('newlist/<int:pk>/detail/', New_Detail.as_view(), name="new_detail"),

    ####工具_备忘录
    path('beiwang/', BeiWang.as_view(), name="beiwang"),##备忘录列表
    path('beiwang/<int:pk>/detail/', BeiWangDetail.as_view(), name="beiwang_detail"),###备忘录详情
    path('beiwang/add/', BeiWangCreate.as_view(), name="beiwang_add"),###添加备忘录
    path('beiwang/<int:pk>/delete/', BeiWangDelete.as_view(), name="beiwang_delete"),###删除备忘录
    # 工具_功能工具
    path('upload/<int:pk>/', upload_excel_file, name='upload_file'),#表格导入
    path('upload_image/', upload_image),  # 插件图片上传入口

    #######工具_站内信
    path('tool_user_zhanneixin/', tool_user_zhanneixin.as_view(), name="tool_user_zhanneixin"),
    path('tool_user_zhanneixin/<int:pk>/detail/', tool_user_zhanneixinDetail.as_view(), name="tool_user_zhanneixin_detail"),
    path('tool_user_zhanneixin/add/', tool_user_zhanneixinCreate.as_view(), name="tool_user_zhanneixin_add"),
    path('tool_user_zhanneixin/<int:pk>/delete/', tool_user_zhanneixinDelete.as_view(), name="tool_user_zhanneixin_delete"),


]
